<table>
    <tbody>
        <tr>
            <td width="120"><?php echo $form->label('CustProductSite.stock_code'); ?></td>
            <td><?php echo $form->text('CustProductSite.stock_code'); ?></td>
            <td width="150px"><?php echo $form->label('Product.category_id', 'Category'); ?></td>
            <td><?php echo $form->select('Product.category_id', $categories, null, array('class' => 'wide')); ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.part_no', 'Vendor Part no.'); ?></td>
            <td colspan="3"><?php echo $form->text('Product.part_no'); ?></td>
        </tr>
        <?php if ($session->read('Auth.User.Extend.from_supplier') != true) : ?>
            <tr>
                <td class="top"><?php echo $form->label('CustProductSite.dispatch_from', 'Dispatch From'); ?></td>
                <td colspan="3">
                <?php echo $form->radio('CustProductSite.dispatch_from', array(ITS_PREFIX => 'ITS', SUPPLIER_PREFIX => 'Other Vendor', '' => 'All'), array('legend' => false)); ?>
                <?php echo $form->select('CustProductSite.supplier_id', $suppliers, null, array('style' => 'display: none;')); ?>
            </td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.brand_id', 'Brand'); ?></td>
            <td colspan="3"><?php echo $form->select('Product.brand_id'); ?></td>
        </tr>
        <?php endif; ?>
            </tbody>
        </table>

        <div class="hide">
    <?php echo $form->select('its_brand_id', $itsBrands, null, array('disabled' => true)); ?>
    <?php echo $form->select('supplier_brand_id', $supplierBrands, null, array('disabled' => true)); ?>
</div>

<script type="text/javascript">
    $j(function() {
        $j.datesearchpicker("#CustProductSiteLastStockInDate");
        $j.datesearchpicker("#CustProductSiteLastStockOutDate");
        $j(':radio').bind('click', function() {
            var dispatch_from = $j(this).val();
            if (dispatch_from == SUPPLIER_PREFIX) {
                $j('#CustProductSiteSupplierId').show();
                $j('#ProductBrandId').html($j('#supplier_brand_id').html());
            } else {
                $j('#CustProductSiteSupplierId').hide().val('');
                $j('#ProductBrandId').html($j('#its_brand_id').html());
            }
        });

        $j(':radio[id=CustProductSiteDispatchFrom]').click()
    })
</script>